package panda.natalia.gothread.suspend.instrument;


import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;

/**
 * a simple framework of java fiber
 *
 * @Author: scpanda2007
 * @Date: 2019/12/10 10:16
 */
public class DBClassWriter extends ClassWriter {

    private final MethodDatabase db;

    public DBClassWriter(MethodDatabase db, ClassReader classReader){
        super(classReader, COMPUTE_FRAMES | COMPUTE_MAXS);
        this.db = db;
    }


    /**
     * 原函数 这个方法需要进行类的加载, 覆盖的方法使用db里缓存的数据进行校验
     * @param s
     * @param s1
     * @return
     */
    @Override
    protected String getCommonSuperClass(String s, String s1) {
        return db.getCommonSuperClass(s, s1);
    }
}
